package com.zmc.member.infrastructure.service.impl;

import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.zmc.member.infrastructure.dao.MemberAuthUsernameDao;
import com.zmc.member.infrastructure.entity.MemberAuthUsernameEntity;
import com.zmc.member.infrastructure.service.MemberAuthUsernameService;
import org.springframework.transaction.annotation.Transactional;


/**
 * @author zmc
 */
@Service("memberAuthUsernameService")
public class MemberAuthUsernameServiceImpl extends ServiceImpl<MemberAuthUsernameDao, MemberAuthUsernameEntity> implements MemberAuthUsernameService {

    @Override
    public MemberAuthUsernameEntity queryByUsername(String account) {
        return null;
    }

    @Override
    @Transactional
    public void updateUsername(String memberId, String username, String newUsername) {
        baseMapper.removeByUsername(username);
        MemberAuthUsernameEntity entity = new MemberAuthUsernameEntity();
        entity.setMemberId(memberId);
        entity.setUsername(newUsername);
        save(entity);
    }
}